﻿using System.IO;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Web;
using System.Xml;

namespace TheGame.Webservices
{
	[ServiceContract]
	public class CrossDomainService
	{
		[OperationContract]
		[WebGet(UriTemplate = "clientaccesspolicy.xml")]
		public Message ProvidePolicyFile()
		{
			if (!File.Exists("clientaccesspolicy.xml"))
				return null;
			MemoryStream ms = new MemoryStream(File.ReadAllBytes("clientaccesspolicy.xml"));
			XmlReader reader = XmlReader.Create(ms);
			return Message.CreateMessage(MessageVersion.None, "", reader);
		}
	}
}